package com.huawei.appgallery.search.api.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import com.huawei.appgallery.search.ui.widget.NormalSearchView.b;
import o.cke;

public class AutoSearchDownloadButton extends DownloadButton {
    b ʼ;

    public AutoSearchDownloadButton(Context context) {
        this(context, null);
    }

    public AutoSearchDownloadButton(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public AutoSearchDownloadButton(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    public void setSearchListener(b bVar) {
        this.ʼ = bVar;
    }

    public void onClick(View view) {
        if (this.ˏ != null) {
            super.onClick(view);
            if (ˋॱ()) {
                String v_ = this.ˏ.v_();
                if (this.ʼ != null && v_ != null) {
                    this.ʼ.ॱ(v_, v_ + "?searchFlag=qSearch_app", false, false);
                }
            }
        }
    }

    private boolean ˋॱ() {
        return !this.ˏ.ᐝॱ() && (this.ˎ == cke.DOWNLOAD_APP || this.ˎ == cke.SMART_UPGRADE_APP || this.ˎ == cke.UPGRADE_APP || this.ˎ == cke.RESUME_DONWLOAD_APP || this.ˎ == cke.RESERVE_DOWNLOAD_APP);
    }
}
